export default {
  methods: {
    batchCopyLink(list = this.list.items) {
      const selectData = this.multipleSelectionAll.length ? this.multipleSelectionAll : list;
      if (!list.length) {
        this.$message.warning('暂无可复制链接');
        return;
      }
      const temp = [];
      selectData.map(it => {
        // 无法查看的链接不加入复制
        if (this.getDetailLink(it)) {
          const notice = it.noticeTemplate || '';
          temp.push(notice + '\n' + this.getDetailLink(it));
        }
      });
      const result = temp.map((it, idx) => idx + 1 + '.' + it).join('\n');
      if (!result) {
        // 所选链接全部无法查看
        this.$message.warning('草稿中审批单无法复制链接');
      } else {
        this.$copyText(result).then(() => {
          this.$message.success('复制成功');
        }, e => {
          console.error(e);
        });
      }
    }
  }
};
